<template>
  <div style="margin-left: 70px">
    <el-tooltip class="item" effect="dark" content="刷新" placement="top">
      <el-button circle icon="Refresh" @click="update" />
    </el-tooltip>
  </div>
  
    <!--<el-table-column type="selection" width="55" />-->
    <el-table
      :data="WaitAssessorList"
      border
      style="width: 90%; margin: 20px auto;border-radius: 8px;box-shadow: 5px 5px 10px rgba(51, 126, 204, 0.5);"
      :header-cell-style="{
          'background': '#337ecc !important',
          'color': '#ffffff',
          'border': 'none !important'
        }">
    	
		
	
		<el-table-column prop="assessorName" label="发布人" width="180" />
    	<el-table-column prop="target" label="关键事项描述" width="180" />
    	<el-table-column prop="totalScore" label="O分值" width="80" />
    	<el-table-column prop="keyResult" label="要求达成的目标" />
    	<el-table-column prop="keyWeight" label="考核分数" width="80"/>
    	<el-table-column prop="ins" label="考核类型" width="150"/>
    	<el-table-column prop="name" label="执行人员姓名" width="180" />
    	<el-table-column prop="amount1" label="完成情况说明" width="230">
			<template #default="scope">
			  <el-button type="success" @click="handleEdit1(scope.$index,scope.row)">实际完成情况</el-button>
			</template>
			
		</el-table-column>
    </el-table>
	
	<Dialog
	  v-model="DialogVisible"
	  :close="close"
	  :update="update"
	  :select="select"
	></Dialog>
	
	
	
</template>
<script setup>
import { ref, onBeforeMount, reactive, getCurrentInstance,watch } from "vue";
import { Timer } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
import { getMyOkr } from "@/api/person";
import { ElMessage } from "element-plus";
import Dialog from "./components/myOkr";

const router = useRouter();

// const handleEdit = (index, row) => {};
// const handleDelete = (index, row) => {};
const WaitAssessorList = ref([]);

let empId = JSON.parse(localStorage.getItem("userInfo")).id;
onBeforeMount(() => {
  getMyOkr({ empId }).then((data) => {
    WaitAssessorList.value = data.data;
  });
});


// const onShowClick = (index,row) => {
//   router.push({
//     path: "./components/myOkr",
//     query: row,
//   });
// };

const update = () => {
  let empId = JSON.parse(localStorage.getItem("userInfo")).id;
  getMyOkr({ empId }).then((data) => {
    if (data.code == 200) {
      ElMessage({
        message: "更新成功",
        type: "success",
      });
      WaitAssessorList.value = data.data;
    } else {
      ElMessage.error("更新成功");
    }
  });
};


let select=reactive()

const DialogVisible = ref(false);

const handleEdit1=(index,row)=>{
  DialogVisible.value = true;
  select=row
}

// const update = () => {
	
//   // getMyOkr(213).then((data) => {
	  
//   // });
// };

const close = ()=>{
	
  DialogVisible.value = false;
}


</script>

<style lang="scss" scoped>
.step {
  width: 1000px;
  margin: 20px auto;
}
</style>
